﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyHospital.BLL;

namespace MyHospital.web
{
    public partial class GetPwd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void BtnResetPwd_Click(object sender, EventArgs e)
        {
            User user = new User();
            if (Page.IsValid)
            {
                if (user.GetPwdEmailExit(inp1.Value, txtEmail.Text.Trim()) == false)
                    lblMsg.Text = "账号或者邮箱不正确!";
                else
                {
                    user.ResetPassword(inp1.Value, txtEmail.Text.Trim());
                    EmailSender emailSender = new EmailSender(txtEmail.Text.Trim(), "abc" + inp1.Value);
                    emailSender.Send();
                    lblMsg.Text = "密码已发送至邮箱！";
                }
            }
        }
    }
}